using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public abstract class EntityStateBase
{
    protected StateMachine stateMachine { get; private set; }
    protected string animName { get; private set; }
    protected Rigidbody2D rb;
    protected Animator animator;
    protected float stateTimer;
    protected bool triggerCalled;
    protected Entity_Stat entityStat;

    public EntityStateBase(StateMachine stateMachine, string animName)
    {
        this.stateMachine = stateMachine;
        this.animName = animName;
    }
    public virtual void Enter()
    {
        triggerCalled = false;
        animator.SetBool(animName, true);
    }
    public virtual void Update()
    {
        stateTimer -= Time.deltaTime;
        UpdateAnimationParameters();
    }
    public virtual void FixedUpdate()
    {

    }
    public virtual void Exit()
    {
        animator.SetBool(animName, false);
    }
    public virtual void AnimatorTrigger()
    {
        triggerCalled = true;
    }
    protected virtual void UpdateAnimationParameters()
    {
        
    }
    protected void SyncAttackSpeed()
    {
        float attackSpeed = entityStat.offense.attackSpeed.GetValue();
        animator.SetFloat("AttackMultiplier", attackSpeed);
    }
}
